/*
 * Copyright (c) 2007-2021 西安交通信息投资营运有限公司 版权所有
 */

package com.xci.xajtfb.bus.api;

import com.github.lvyanyang.annotation.Authorize;
import com.github.lvyanyang.core.BaseController;
import com.github.lvyanyang.core.BoolResult;
import com.github.lvyanyang.core.Const;
import com.github.lvyanyang.core.PageList;
import com.xci.xajtfb.bus.service.TbBusLineService;
import com.github.lvyanyang.model.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperationSupport;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 公交线路接口
 * @author 吕艳阳 lvyanyang@xci96716.com
 * @since 2021-02-05 17:30:26
 */
@Api(tags = "公交线路接口")
@Authorize
@RestController
@RequestMapping(value = "/api/bus/line", produces = Const.PROJSON)
public class TbBusLineApiController extends BaseController {
    /** 公交线路服务 */
    @Resource private TbBusLineService tbBusLineService;

    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "根据名称查询线路列表")
    //@Authorize(code = "om.synTbbusline.select")
    @PostMapping("/selectByName")
    public BoolResult<List<Map<String, Object>>> selectByName(String name) {
        return BoolResult.success(tbBusLineService.selectByName(name));
    }

    @ApiOperationSupport(order = 7)
    @ApiOperation(value = "根据主键查询单个")
    //@Authorize(code = "om.synTbbusline.select")
    @PostMapping("/selectById")
    public BoolResult<Map<String,Object>> selectById(@RequestBody IdBody body) {
        return BoolResult.success(tbBusLineService.selectById(body.getId()));
    }

    @ApiOperationSupport(order = 9)
    @ApiOperation(value = "查询分页列表")
    //@Authorize(code = "om.synTbbusline.select")
    @PostMapping("/selectPageList")
    public BoolResult<PageList<Map<String,Object>>> selectPageList(@RequestBody Map<String,Object> filter) {
        return BoolResult.success(tbBusLineService.selectPageList(filter));
    }
}